package com.small.nacos.naming.cluster.transport;

import com.small.nacos.common.utils.JacksonUtils;
import org.springframework.stereotype.Component;

/**
 * @Author zhoujin
 * @Date 2022/11/13 18:36
 */
@Component
public class JacksonSerializer implements Serializer{

    @Override
    public <T> byte[] serialize(T data) {
        return JacksonUtils.toJsonBytes(data);
    }

    @Override
    public <T> T deserialize(byte[] data, Class<T> clazz) {
        return JacksonUtils.toObj(data, clazz);
    }


}
